var app = getApp();
var Util = require('../../utils/util.js')
var Json = require('../../json.js')
var WxParse = require('../../wxParse/wxParse.js');

Page({
  /**
   * 页面的初始数据s
   */

  data: {
    parameter: {
      'title': '申请保修',
      'navbar': '1'
    },
    images: ['http://q2di1ml9j.bkt.clouddn.com/6H0%5B1CMUXDWA%60%29XG@G7AZZL.png', 'http://q2di1ml9j.bkt.clouddn.com/6H0%5B1CMUXDWA%60%29XG@G7AZZL.png'],
    flows: [{
        logoUrl: 'http://q2di1ml9j.bkt.clouddn.com/6H0%5B1CMUXDWA%60%29XG@G7AZZL.png',
        desc: "提出申请",
        title: "王小飞"
      },
      {
        logoUrl: 'http://q2di1ml9j.bkt.clouddn.com/6H0%5B1CMUXDWA%60%29XG@G7AZZL.png',
        desc: "李晓龙 18236253696",
        title: "太原海星"
      },
      {
        logoUrl: 'http://q2di1ml9j.bkt.clouddn.com/6H0%5B1CMUXDWA%60%29XG@G7AZZL.png',
        desc: "<img src='http://q2di1ml9j.bkt.clouddn.com/6H0%5B1CMUXDWA%60%29XG@G7AZZL.png' style='width:60px;height:60px;'/><img src='http://q2di1ml9j.bkt.clouddn.com/6H0%5B1CMUXDWA%60%29XG@G7AZZL.png' style='width:60px;height:60px;'/>",
        title: "已经修好"
      },
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

  },


  catchTouchMove: function(res) {
    return false
  },
  onColse: function() {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

    var that = this

    //模拟数据
    that.setData({
      user: Json.default.userIn,
      apply: Json.default.repairReceive
    })

    var result = this.data.flows; //请求到的数据  数组形式
    var len = result.length;

    for (let i = 0; i < len; i++) {

      WxParse.wxParse('flow' + i, 'html', result[i].desc, that, 5); //转化html  单文件

      if (i === len - 1) {
        WxParse.wxParseTemArray("flowHtmls", 'flow', len, that)
      }
    }
  },
  formSubmit: function(e) {
    app.Tips({
      title: '提交成功',
      icon: 'success'
    }, '/pages/index/index');
  }
})